<script setup lang="ts">
import { useAsyncRouteStore } from '@/stores/async-routes';
import { RouterView } from 'vue-router';

defineOptions({
  name: 'LayoutMain',
});

const asyncRouteStore = useAsyncRouteStore();
const keepAliveRouteComponents = computed(() => asyncRouteStore.cachedRoutes);
</script>

<template>
  <RouterView>
    <template #default="{ Component, route }">
      <ACard :bordered="false" class="h-full m-3">
        <KeepAlive :include="keepAliveRouteComponents">
          <Component :is="Component" :key="route.fullPath" />
        </KeepAlive>
      </ACard>
    </template>
  </RouterView>
</template>
